package org.vineatoum.view.utils.jtablecustom;

import java.awt.Color;
import java.awt.Component;

import javax.swing.DefaultCellEditor;
import javax.swing.JTable;
import javax.swing.JTextField;

class JTableCustomEditor extends DefaultCellEditor {

	private static final long serialVersionUID = 777415151837519179L;
	javax.swing.JTextField jtf;

	public JTableCustomEditor() {
		super(new javax.swing.JTextField());

	}

	public java.awt.Component getTableCellEditorComponent(JTable table,
			Object value, boolean isSelected, int row, int column) {
		Component c = super.getTableCellEditorComponent(table, value,
				isSelected, row, column);
		if (c instanceof JTextField) {
			jtf = ((JTextField) c);
			jtf.selectAll();
			jtf.setBorder(javax.swing.BorderFactory.createLineBorder(Color.BLACK, 1));
			table.setSurrendersFocusOnKeystroke(true);
		}

		return c;
	}
}